export const statusOptions = [
  { label: '禁用', value: '0' },
  { label: '启用', value: '1' }
];

export const rules = {
  name: [
    { required: true, message: '项目名称必填', type: 'error', trigger: 'blur' },
    { whitespace: true, message: '项目名称不能为空' },
    { min: 1, message: '项目名称在1到10之间', type: 'error', trigger: 'blur' },
    { max: 10, message: '项目名称在1到10之间', type: 'error', trigger: 'blur' }
  ],
  price: [
    { required: true, message: '价格必填', type: 'error' },
    { number: true, message: '请输入数字', type: 'warning' }
  ],
  unit: [
    { required: true, message: '单位必填', type: 'warning', trigger: 'blur' },
    { whitespace: true, message: '单位不能为空' },
    { min: 1, message: '单位在1到5之间', type: 'warning', trigger: 'blur' },
    { max: 5, message: '单位在1到5之间', type: 'warning', trigger: 'blur' }
  ],
  orderNo: [
    { required: true, message: '排序必填', type: 'warning' },
    { number: true, message: '请输入数字', type: 'warning' }
  ],
  image: [{ required: true, message: '请先上传护理图片', type: 'warning' }],
  nursingRequirement: [
    { required: true, message: '护理项目描述必填', type: 'warning' },
    { whitespace: true, message: '护理项目描述不能为空' },
    { min: 1, message: '描述在1到50之间', type: 'warning', trigger: 'blur' },
    { max: 50, message: '描述在1到50之间', type: 'warning', trigger: 'blur' }
  ]
}

// export const statusNameListMap = {
//   0: { label: '禁用', theme: 'danger'},
//   1: { label: '启用', theme: 'success'},
// };

export const tableColumns = [
  {
    title: '序号',
    colKey: 'rowIndex',
  },
  {
    title: '护理图片',
    colKey: 'image',
  },
  {
    title: '护理项目名称',
    colKey: 'name',
  },
  {
    title: '价格',
    colKey: 'price',
  },
  {
    title: '单位',
    colKey: 'unit',
  },
  {
    title: '排序',
    colKey: 'orderNo',
  },
  {
    title: '创建人',
    colKey: 'creator',
  },
  {
    title: '创建时间',
    colKey: 'createTime',
  },
  {
    title: '状态',
    colKey: 'status',
    cell: (h,{row}) =>{
      //状态名称列表映射
      const statusNameListMap = {
        0: { label: '禁用', theme: 'danger'},
        1: { label: '启用', theme: 'success'},
      };
      return h(
        'span',
        {
          class: `status-dot status-dot-${row.status}`
        },
        statusNameListMap[row.status].label
      )
    }
  },
  {
    title: '操作',
    colKey: 'op',
  },
];
